Imports System.IO
Imports System.ComponentModel

Imports DevExpress.XtraGrid

Imports Phoenix.DataAccess
Imports Phoenix.Events
Imports Phoenix.Helpers
Imports Phoenix.Preferences



Namespace Forms
    Public Class BillForm : Inherits ChildFormBase

#Region " Windows Form Designer generated code "

        Public Sub New()
            MyBase.New()

            'This call is required by the Windows Form Designer.
            InitializeComponent()

            'Add any initialization after the InitializeComponent() call
            SaveBarItem.Enabled = False
            SaveBarItem.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
            mAdditionalServiceDS.EnforceConstraints = False
        End Sub

        'UserControl overrides dispose to clean up the component list.
        Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
            If disposing Then
                If Not (components Is Nothing) Then
                    components.Dispose()
                End If
            End If
            MyBase.Dispose(disposing)
        End Sub

        'Required by the Windows Form Designer
        Private components As System.ComponentModel.IContainer
        Friend WithEvents CostBox As DevExpress.XtraEditors.TextEdit
        Friend WithEvents Tabs As System.Windows.Forms.TabControl
        Friend WithEvents TabPageServices As System.Windows.Forms.TabPage
        Friend WithEvents ServiceGrid As DevExpress.XtraGrid.GridControl
        Friend WithEvents ClientLabel As System.Windows.Forms.Label
        Friend WithEvents ClientControl As Phoenix.Forms.Controls.BillClientEdit
        Friend WithEvents TabPageProducts As System.Windows.Forms.TabPage
        Friend WithEvents TabPagePayments As System.Windows.Forms.TabPage
        Friend WithEvents ServiceView As DevExpress.XtraGrid.Views.Grid.GridView
        Friend WithEvents SelectedColumn As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents SelectedRI As DevExpress.XtraEditors.Repository.RepositoryItemCheckEdit
        Friend WithEvents IconColumn As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents IconRI As DevExpress.XtraEditors.Repository.RepositoryItemImageComboBox
        Friend WithEvents NameColumn As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents TypeColumn As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents CostColumn As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents AvailableProductGrid As DevExpress.XtraGrid.GridControl
        Friend WithEvents ALabelColumn As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents ATypeColumn As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents AFamilyFamily As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents ACostColumn As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents AIconColumn As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents AIconRI As DevExpress.XtraEditors.Repository.RepositoryItemImageComboBox
        Friend WithEvents AvailableProductView As DevExpress.XtraGrid.Views.Grid.GridView
        Friend WithEvents SelectedProductGrid As DevExpress.XtraGrid.GridControl
        Friend WithEvents SIconColumn As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents SLabelColumn As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents STypeColumn As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents SFamilyColumn As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents SCostColunm As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents SIconRI As DevExpress.XtraEditors.Repository.RepositoryItemImageComboBox
        Friend WithEvents SelectedProductView As DevExpress.XtraGrid.Views.Grid.GridView
        Friend WithEvents AddButton As System.Windows.Forms.Button
        Friend WithEvents RemoveButton As System.Windows.Forms.Button
        Friend WithEvents PaymentGrid As DevExpress.XtraGrid.GridControl
        Friend WithEvents PaymentView As DevExpress.XtraGrid.Views.Grid.GridView
        Friend WithEvents PaidBox As DevExpress.XtraEditors.TextEdit
        Friend WithEvents PSumColumn As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents PTypeColumn As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents PSumRI As DevExpress.XtraEditors.Repository.RepositoryItemCalcEdit
        Friend WithEvents PTypeRI As DevExpress.XtraEditors.Repository.RepositoryItemRadioGroup
        Friend WithEvents PCardColumn As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents PCardRI As DevExpress.XtraEditors.Repository.RepositoryItemComboBox
        Friend WithEvents PaidLabel As System.Windows.Forms.Label
        Friend WithEvents AmountLabel As System.Windows.Forms.Label
        Friend WithEvents LeftBox As DevExpress.XtraEditors.TextEdit
        Friend WithEvents LeftLabel As System.Windows.Forms.Label
        Friend WithEvents ErrorProvider As System.Windows.Forms.ErrorProvider
        Friend WithEvents EmployeeControl As Phoenix.Forms.Controls.EmployeeFieldEdit
        Friend WithEvents SoldByLabel As System.Windows.Forms.Label
        Friend WithEvents AStockColumn As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents ResetClientButton As DevExpress.XtraEditors.SimpleButton
        Friend WithEvents AdditionalServiceGrid As DevExpress.XtraGrid.GridControl
        Friend WithEvents AdditionServiceView As DevExpress.XtraGrid.Views.Grid.GridView
        Friend WithEvents AsServiceGrid As DevExpress.XtraGrid.GridControl
        Friend WithEvents AsServiceView As DevExpress.XtraGrid.Views.Grid.GridView
        Friend WithEvents AsServicePopupControl As DevExpress.XtraEditors.PopupContainerControl
        Friend WithEvents AsServiceType As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents AsServiceLabel As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents AsServiceIcon As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents AsServiceIconRI As DevExpress.XtraEditors.Repository.RepositoryItemImageComboBox
        Friend WithEvents AddServiceColumn As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents AddServiceRI As DevExpress.XtraEditors.Repository.RepositoryItemPopupContainerEdit
        Friend WithEvents AddServiceIconColumn As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents AddServiceIconRI As DevExpress.XtraEditors.Repository.RepositoryItemImageComboBox
        Friend WithEvents AddPerformerColumn As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents AddPerformerRI As DevExpress.XtraEditors.Repository.RepositoryItemPopupContainerEdit
        Friend WithEvents AsEmployeePopupControl As DevExpress.XtraEditors.PopupContainerControl
        Friend WithEvents AsEmployeeGrid As DevExpress.XtraGrid.GridControl
        Friend WithEvents AddPrice As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents AsEmployeeView As DevExpress.XtraGrid.Views.Grid.GridView
        Friend WithEvents AsEmployeeIcon As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents AsEmployeeName As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents AsEmployeeIconRI As DevExpress.XtraEditors.Repository.RepositoryItemImageComboBox
        Friend WithEvents AsEmployeeSys As DevExpress.XtraGrid.Columns.GridColumn
        Friend WithEvents ChangeBox As DevExpress.XtraEditors.TextEdit
        Friend WithEvents Label1 As System.Windows.Forms.Label
        Friend WithEvents ProductCostRI As DevExpress.XtraEditors.Repository.RepositoryItemTextEdit
        Friend WithEvents AsEmployeeActive As DevExpress.XtraGrid.Columns.GridColumn


        Private Sub InitializeComponent()
            Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(BillForm))
            Me.PaidBox = New DevExpress.XtraEditors.TextEdit
            Me.PaidLabel = New System.Windows.Forms.Label
            Me.CostBox = New DevExpress.XtraEditors.TextEdit
            Me.AmountLabel = New System.Windows.Forms.Label
            Me.Tabs = New System.Windows.Forms.TabControl
            Me.TabPageServices = New System.Windows.Forms.TabPage
            Me.AsServicePopupControl = New DevExpress.XtraEditors.PopupContainerControl
            Me.AsEmployeePopupControl = New DevExpress.XtraEditors.PopupContainerControl
            Me.AsEmployeeGrid = New DevExpress.XtraGrid.GridControl
            Me.AsEmployeeView = New DevExpress.XtraGrid.Views.Grid.GridView
            Me.AsEmployeeIcon = New DevExpress.XtraGrid.Columns.GridColumn
            Me.AsEmployeeIconRI = New DevExpress.XtraEditors.Repository.RepositoryItemImageComboBox
            Me.AsEmployeeName = New DevExpress.XtraGrid.Columns.GridColumn
            Me.AsEmployeeSys = New DevExpress.XtraGrid.Columns.GridColumn
            Me.AsEmployeeActive = New DevExpress.XtraGrid.Columns.GridColumn
            Me.AsServiceGrid = New DevExpress.XtraGrid.GridControl
            Me.AsServiceView = New DevExpress.XtraGrid.Views.Grid.GridView
            Me.AsServiceIcon = New DevExpress.XtraGrid.Columns.GridColumn
            Me.AsServiceIconRI = New DevExpress.XtraEditors.Repository.RepositoryItemImageComboBox
            Me.AsServiceLabel = New DevExpress.XtraGrid.Columns.GridColumn
            Me.AsServiceType = New DevExpress.XtraGrid.Columns.GridColumn
            Me.AdditionalServiceGrid = New DevExpress.XtraGrid.GridControl
            Me.AdditionServiceView = New DevExpress.XtraGrid.Views.Grid.GridView
            Me.AddServiceIconColumn = New DevExpress.XtraGrid.Columns.GridColumn
            Me.AddServiceIconRI = New DevExpress.XtraEditors.Repository.RepositoryItemImageComboBox
            Me.AddServiceColumn = New DevExpress.XtraGrid.Columns.GridColumn
            Me.AddServiceRI = New DevExpress.XtraEditors.Repository.RepositoryItemPopupContainerEdit
            Me.AddPerformerColumn = New DevExpress.XtraGrid.Columns.GridColumn
            Me.AddPerformerRI = New DevExpress.XtraEditors.Repository.RepositoryItemPopupContainerEdit
            Me.AddPrice = New DevExpress.XtraGrid.Columns.GridColumn
            Me.ResetClientButton = New DevExpress.XtraEditors.SimpleButton
            Me.ServiceGrid = New DevExpress.XtraGrid.GridControl
            Me.ServiceView = New DevExpress.XtraGrid.Views.Grid.GridView
            Me.SelectedColumn = New DevExpress.XtraGrid.Columns.GridColumn
            Me.SelectedRI = New DevExpress.XtraEditors.Repository.RepositoryItemCheckEdit
            Me.IconColumn = New DevExpress.XtraGrid.Columns.GridColumn
            Me.IconRI = New DevExpress.XtraEditors.Repository.RepositoryItemImageComboBox
            Me.NameColumn = New DevExpress.XtraGrid.Columns.GridColumn
            Me.TypeColumn = New DevExpress.XtraGrid.Columns.GridColumn
            Me.CostColumn = New DevExpress.XtraGrid.Columns.GridColumn
            Me.ClientLabel = New System.Windows.Forms.Label
            Me.ClientControl = New Phoenix.Forms.Controls.BillClientEdit
            Me.TabPageProducts = New System.Windows.Forms.TabPage
            Me.SoldByLabel = New System.Windows.Forms.Label
            Me.EmployeeControl = New Phoenix.Forms.Controls.EmployeeFieldEdit
            Me.RemoveButton = New System.Windows.Forms.Button
            Me.AddButton = New System.Windows.Forms.Button
            Me.SelectedProductGrid = New DevExpress.XtraGrid.GridControl
            Me.SelectedProductView = New DevExpress.XtraGrid.Views.Grid.GridView
            Me.SIconColumn = New DevExpress.XtraGrid.Columns.GridColumn
            Me.SIconRI = New DevExpress.XtraEditors.Repository.RepositoryItemImageComboBox
            Me.SLabelColumn = New DevExpress.XtraGrid.Columns.GridColumn
            Me.STypeColumn = New DevExpress.XtraGrid.Columns.GridColumn
            Me.SFamilyColumn = New DevExpress.XtraGrid.Columns.GridColumn
            Me.SCostColunm = New DevExpress.XtraGrid.Columns.GridColumn
            Me.ProductCostRI = New DevExpress.XtraEditors.Repository.RepositoryItemTextEdit
            Me.AvailableProductGrid = New DevExpress.XtraGrid.GridControl
            Me.AvailableProductView = New DevExpress.XtraGrid.Views.Grid.GridView
            Me.AIconColumn = New DevExpress.XtraGrid.Columns.GridColumn
            Me.AIconRI = New DevExpress.XtraEditors.Repository.RepositoryItemImageComboBox
            Me.ALabelColumn = New DevExpress.XtraGrid.Columns.GridColumn
            Me.ATypeColumn = New DevExpress.XtraGrid.Columns.GridColumn
            Me.AFamilyFamily = New DevExpress.XtraGrid.Columns.GridColumn
            Me.ACostColumn = New DevExpress.XtraGrid.Columns.GridColumn
            Me.AStockColumn = New DevExpress.XtraGrid.Columns.GridColumn
            Me.TabPagePayments = New System.Windows.Forms.TabPage
            Me.PaymentGrid = New DevExpress.XtraGrid.GridControl
            Me.PaymentView = New DevExpress.XtraGrid.Views.Grid.GridView
            Me.PTypeColumn = New DevExpress.XtraGrid.Columns.GridColumn
            Me.PTypeRI = New DevExpress.XtraEditors.Repository.RepositoryItemRadioGroup
            Me.PCardColumn = New DevExpress.XtraGrid.Columns.GridColumn
            Me.PCardRI = New DevExpress.XtraEditors.Repository.RepositoryItemComboBox
            Me.PSumColumn = New DevExpress.XtraGrid.Columns.GridColumn
            Me.PSumRI = New DevExpress.XtraEditors.Repository.RepositoryItemCalcEdit
            Me.LeftBox = New DevExpress.XtraEditors.TextEdit
            Me.LeftLabel = New System.Windows.Forms.Label
            Me.ErrorProvider = New System.Windows.Forms.ErrorProvider
            Me.ChangeBox = New DevExpress.XtraEditors.TextEdit
            Me.Label1 = New System.Windows.Forms.Label
            CType(Me.PaidBox.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.CostBox.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
            Me.Tabs.SuspendLayout()
            Me.TabPageServices.SuspendLayout()
            Me.AsServicePopupControl.SuspendLayout()
            Me.AsEmployeePopupControl.SuspendLayout()
            CType(Me.AsEmployeeGrid, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.AsEmployeeView, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.AsEmployeeIconRI, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.AsServiceGrid, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.AsServiceView, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.AsServiceIconRI, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.AdditionalServiceGrid, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.AdditionServiceView, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.AddServiceIconRI, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.AddServiceRI, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.AddPerformerRI, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.ServiceGrid, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.ServiceView, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.SelectedRI, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.IconRI, System.ComponentModel.ISupportInitialize).BeginInit()
            Me.TabPageProducts.SuspendLayout()
            CType(Me.SelectedProductGrid, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.SelectedProductView, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.SIconRI, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.ProductCostRI, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.AvailableProductGrid, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.AvailableProductView, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.AIconRI, System.ComponentModel.ISupportInitialize).BeginInit()
            Me.TabPagePayments.SuspendLayout()
            CType(Me.PaymentGrid, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.PaymentView, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.PTypeRI, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.PCardRI, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.PSumRI, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.LeftBox.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.ChangeBox.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
            Me.SuspendLayout()
            '
            'PaidBox
            '
            Me.PaidBox.EditValue = 0
            Me.PaidBox.Location = New System.Drawing.Point(104, 72)
            Me.PaidBox.Name = "PaidBox"
            '
            'PaidBox.Properties
            '
            Me.PaidBox.Properties.DisplayFormat.FormatString = "c2"
            Me.PaidBox.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric
            Me.PaidBox.Properties.EditFormat.FormatString = "c2"
            Me.PaidBox.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric
            Me.PaidBox.Properties.Enabled = False
            Me.PaidBox.Properties.ReadOnly = True
            Me.PaidBox.Properties.StyleDisabled = New DevExpress.Utils.ViewStyle("ControlStyleDisabled", Nothing, New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(204, Byte)), "", DevExpress.Utils.StyleOptions.StyleEnabled, True, False, False, DevExpress.Utils.HorzAlignment.Default, DevExpress.Utils.VertAlignment.Center, Nothing, System.Drawing.SystemColors.Window, System.Drawing.SystemColors.WindowText)
            Me.PaidBox.Size = New System.Drawing.Size(72, 20)
            Me.PaidBox.TabIndex = 4
            '
            'PaidLabel
            '
            Me.PaidLabel.Location = New System.Drawing.Point(104, 56)
            Me.PaidLabel.Name = "PaidLabel"
            Me.PaidLabel.Size = New System.Drawing.Size(40, 16)
            Me.PaidLabel.TabIndex = 3
            Me.PaidLabel.Text = "Paid:"
            '
            'CostBox
            '
            Me.CostBox.EditValue = 0
            Me.CostBox.Location = New System.Drawing.Point(8, 72)
            Me.CostBox.Name = "CostBox"
            '
            'CostBox.Properties
            '
            Me.CostBox.Properties.DisplayFormat.FormatString = "c2"
            Me.CostBox.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric
            Me.CostBox.Properties.EditFormat.FormatString = "c2"
            Me.CostBox.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric
            Me.CostBox.Properties.Enabled = False
            Me.CostBox.Properties.ReadOnly = True
            Me.CostBox.Properties.StyleDisabled = New DevExpress.Utils.ViewStyle("ControlStyleDisabled", Nothing, New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(204, Byte)), "", DevExpress.Utils.StyleOptions.StyleEnabled, True, False, False, DevExpress.Utils.HorzAlignment.Default, DevExpress.Utils.VertAlignment.Center, Nothing, System.Drawing.SystemColors.Window, System.Drawing.SystemColors.WindowText)
            Me.CostBox.Size = New System.Drawing.Size(72, 20)
            Me.CostBox.TabIndex = 2
            '
            'AmountLabel
            '
            Me.AmountLabel.Location = New System.Drawing.Point(8, 58)
            Me.AmountLabel.Name = "AmountLabel"
            Me.AmountLabel.Size = New System.Drawing.Size(80, 16)
            Me.AmountLabel.TabIndex = 1
            Me.AmountLabel.Text = "Amount Due :"
            '
            'Tabs
            '
            Me.Tabs.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                        Or System.Windows.Forms.AnchorStyles.Left) _
                        Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
            Me.Tabs.Controls.Add(Me.TabPageServices)
            Me.Tabs.Controls.Add(Me.TabPageProducts)
            Me.Tabs.Controls.Add(Me.TabPagePayments)
            Me.Tabs.Location = New System.Drawing.Point(0, 104)
            Me.Tabs.Name = "Tabs"
            Me.Tabs.SelectedIndex = 0
            Me.Tabs.Size = New System.Drawing.Size(496, 392)
            Me.Tabs.TabIndex = 0
            '
            'TabPageServices
            '
            Me.TabPageServices.Controls.Add(Me.AsServicePopupControl)
            Me.TabPageServices.Controls.Add(Me.AdditionalServiceGrid)
            Me.TabPageServices.Controls.Add(Me.ResetClientButton)
            Me.TabPageServices.Controls.Add(Me.ServiceGrid)
            Me.TabPageServices.Controls.Add(Me.ClientLabel)
            Me.TabPageServices.Controls.Add(Me.ClientControl)
            Me.TabPageServices.Location = New System.Drawing.Point(4, 22)
            Me.TabPageServices.Name = "TabPageServices"
            Me.TabPageServices.Size = New System.Drawing.Size(488, 366)
            Me.TabPageServices.TabIndex = 0
            Me.TabPageServices.Text = "Services"
            '
            'AsServicePopupControl
            '
            Me.AsServicePopupControl.Controls.Add(Me.AsEmployeePopupControl)
            Me.AsServicePopupControl.Controls.Add(Me.AsServiceGrid)
            Me.AsServicePopupControl.Location = New System.Drawing.Point(72, 72)
            Me.AsServicePopupControl.Name = "AsServicePopupControl"
            Me.AsServicePopupControl.Size = New System.Drawing.Size(328, 200)
            Me.AsServicePopupControl.TabIndex = 5
            '
            'AsEmployeePopupControl
            '
            Me.AsEmployeePopupControl.Controls.Add(Me.AsEmployeeGrid)
            Me.AsEmployeePopupControl.Location = New System.Drawing.Point(88, 40)
            Me.AsEmployeePopupControl.Name = "AsEmployeePopupControl"
            Me.AsEmployeePopupControl.Size = New System.Drawing.Size(320, 144)
            Me.AsEmployeePopupControl.TabIndex = 6
            '
            'AsEmployeeGrid
            '
            Me.AsEmployeeGrid.Dock = System.Windows.Forms.DockStyle.Fill
            '
            'AsEmployeeGrid.EmbeddedNavigator
            '
            Me.AsEmployeeGrid.EmbeddedNavigator.Name = ""
            Me.AsEmployeeGrid.Location = New System.Drawing.Point(0, 0)
            Me.AsEmployeeGrid.MainView = Me.AsEmployeeView
            Me.AsEmployeeGrid.Name = "AsEmployeeGrid"
            Me.AsEmployeeGrid.RepositoryItems.AddRange(New DevExpress.XtraEditors.Repository.RepositoryItem() {Me.AsEmployeeIconRI})
            Me.AsEmployeeGrid.Size = New System.Drawing.Size(320, 144)
            Me.AsEmployeeGrid.TabIndex = 0
            Me.AsEmployeeGrid.Text = "GridControl1"
            '
            'AsEmployeeView
            '
            Me.AsEmployeeView.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.AsEmployeeIcon, Me.AsEmployeeName, Me.AsEmployeeSys, Me.AsEmployeeActive})
            Me.AsEmployeeView.GridControl = Me.AsEmployeeGrid
            Me.AsEmployeeView.Name = "AsEmployeeView"
            Me.AsEmployeeView.OptionsBehavior.AllowIncrementalSearch = True
            Me.AsEmployeeView.OptionsBehavior.Editable = False
            Me.AsEmployeeView.OptionsDetail.EnableMasterViewMode = False
            Me.AsEmployeeView.OptionsView.ShowFilterPanel = False
            Me.AsEmployeeView.OptionsView.ShowGroupPanel = False
            Me.AsEmployeeView.OptionsView.ShowIndicator = False
            Me.AsEmployeeView.OptionsView.ShowVertLines = False
            '
            'AsEmployeeIcon
            '
            Me.AsEmployeeIcon.ColumnEdit = Me.AsEmployeeIconRI
            Me.AsEmployeeIcon.Name = "AsEmployeeIcon"
            Me.AsEmployeeIcon.Options = CType(((DevExpress.XtraGrid.Columns.ColumnOptions.ReadOnly Or DevExpress.XtraGrid.Columns.ColumnOptions.FixedWidth) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.NonEditable), DevExpress.XtraGrid.Columns.ColumnOptions)
            Me.AsEmployeeIcon.VisibleIndex = 0
            Me.AsEmployeeIcon.Width = 24
            '
            'AsEmployeeIconRI
            '
            Me.AsEmployeeIconRI.AutoHeight = False
            Me.AsEmployeeIconRI.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
            Me.AsEmployeeIconRI.Items.AddRange(New Object() {New DevExpress.XtraEditors.Controls.ImageComboBoxItem("", Nothing, 4)})
            Me.AsEmployeeIconRI.Name = "AsEmployeeIconRI"
            '
            'AsEmployeeName
            '
            Me.AsEmployeeName.Caption = "Name"
            Me.AsEmployeeName.FieldName = "FullName"
            Me.AsEmployeeName.Name = "AsEmployeeName"
            Me.AsEmployeeName.VisibleIndex = 1
            '
            'AsEmployeeSys
            '
            Me.AsEmployeeSys.Caption = "System"
            Me.AsEmployeeSys.FieldName = "Sys"
            Me.AsEmployeeSys.Name = "AsEmployeeSys"
            Me.AsEmployeeSys.Options = DevExpress.XtraGrid.Columns.ColumnOptions.CanFiltered
            '
            'AsEmployeeActive
            '
            Me.AsEmployeeActive.Caption = "Active"
            Me.AsEmployeeActive.FieldName = "IsAttendant"
            Me.AsEmployeeActive.Name = "AsEmployeeActive"
            Me.AsEmployeeActive.Options = DevExpress.XtraGrid.Columns.ColumnOptions.CanFiltered
            '
            'AsServiceGrid
            '
            Me.AsServiceGrid.Dock = System.Windows.Forms.DockStyle.Fill
            '
            'AsServiceGrid.EmbeddedNavigator
            '
            Me.AsServiceGrid.EmbeddedNavigator.Name = ""
            Me.AsServiceGrid.Location = New System.Drawing.Point(0, 0)
            Me.AsServiceGrid.MainView = Me.AsServiceView
            Me.AsServiceGrid.Name = "AsServiceGrid"
            Me.AsServiceGrid.RepositoryItems.AddRange(New DevExpress.XtraEditors.Repository.RepositoryItem() {Me.AsServiceIconRI})
            Me.AsServiceGrid.Size = New System.Drawing.Size(328, 200)
            Me.AsServiceGrid.TabIndex = 0
            Me.AsServiceGrid.Text = "AsServiceGrid"
            '
            'AsServiceView
            '
            Me.AsServiceView.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.AsServiceIcon, Me.AsServiceLabel, Me.AsServiceType})
            Me.AsServiceView.GridControl = Me.AsServiceGrid
            Me.AsServiceView.Name = "AsServiceView"
            Me.AsServiceView.OptionsBehavior.AllowIncrementalSearch = True
            Me.AsServiceView.OptionsBehavior.Editable = False
            Me.AsServiceView.OptionsDetail.EnableMasterViewMode = False
            Me.AsServiceView.OptionsView.ShowGroupPanel = False
            Me.AsServiceView.OptionsView.ShowIndicator = False
            Me.AsServiceView.OptionsView.ShowVertLines = False
            '
            'AsServiceIcon
            '
            Me.AsServiceIcon.ColumnEdit = Me.AsServiceIconRI
            Me.AsServiceIcon.Name = "AsServiceIcon"
            Me.AsServiceIcon.Options = CType(((DevExpress.XtraGrid.Columns.ColumnOptions.ReadOnly Or DevExpress.XtraGrid.Columns.ColumnOptions.FixedWidth) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.NonEditable), DevExpress.XtraGrid.Columns.ColumnOptions)
            Me.AsServiceIcon.VisibleIndex = 0
            Me.AsServiceIcon.Width = 24
            '
            'AsServiceIconRI
            '
            Me.AsServiceIconRI.AutoHeight = False
            Me.AsServiceIconRI.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
            Me.AsServiceIconRI.Items.AddRange(New Object() {New DevExpress.XtraEditors.Controls.ImageComboBoxItem("", Nothing, 6)})
            Me.AsServiceIconRI.Name = "AsServiceIconRI"
            '
            'AsServiceLabel
            '
            Me.AsServiceLabel.Caption = "Label"
            Me.AsServiceLabel.FieldName = "Label"
            Me.AsServiceLabel.Name = "AsServiceLabel"
            Me.AsServiceLabel.VisibleIndex = 1
            Me.AsServiceLabel.Width = 150
            '
            'AsServiceType
            '
            Me.AsServiceType.Caption = "Type"
            Me.AsServiceType.FieldName = "Type"
            Me.AsServiceType.Name = "AsServiceType"
            Me.AsServiceType.VisibleIndex = 2
            Me.AsServiceType.Width = 152
            '
            'AdditionalServiceGrid
            '
            Me.AdditionalServiceGrid.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _
                        Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
            '
            'AdditionalServiceGrid.EmbeddedNavigator
            '
            Me.AdditionalServiceGrid.EmbeddedNavigator.Buttons.First.Visible = False
            Me.AdditionalServiceGrid.EmbeddedNavigator.Buttons.Last.Visible = False
            Me.AdditionalServiceGrid.EmbeddedNavigator.Buttons.Next.Visible = False
            Me.AdditionalServiceGrid.EmbeddedNavigator.Buttons.NextPage.Visible = False
            Me.AdditionalServiceGrid.EmbeddedNavigator.Buttons.Prev.Visible = False
            Me.AdditionalServiceGrid.EmbeddedNavigator.Buttons.PrevPage.Visible = False
            Me.AdditionalServiceGrid.EmbeddedNavigator.Name = ""
            Me.AdditionalServiceGrid.Location = New System.Drawing.Point(8, 200)
            Me.AdditionalServiceGrid.MainView = Me.AdditionServiceView
            Me.AdditionalServiceGrid.Name = "AdditionalServiceGrid"
            Me.AdditionalServiceGrid.RepositoryItems.AddRange(New DevExpress.XtraEditors.Repository.RepositoryItem() {Me.AddServiceRI, Me.AddServiceIconRI, Me.AddPerformerRI})
            Me.AdditionalServiceGrid.Size = New System.Drawing.Size(472, 160)
            Me.AdditionalServiceGrid.TabIndex = 4
            Me.AdditionalServiceGrid.Text = "GridControl1"
            Me.AdditionalServiceGrid.UseEmbeddedNavigator = True
            '
            'AdditionServiceView
            '
            Me.AdditionServiceView.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.AddServiceIconColumn, Me.AddServiceColumn, Me.AddPerformerColumn, Me.AddPrice})
            Me.AdditionServiceView.GridControl = Me.AdditionalServiceGrid
            Me.AdditionServiceView.Name = "AdditionServiceView"
            Me.AdditionServiceView.OptionsDetail.EnableMasterViewMode = False
            Me.AdditionServiceView.OptionsView.ShowGroupPanel = False
            Me.AdditionServiceView.OptionsView.ShowNewItemRow = True
            Me.AdditionServiceView.OptionsView.ShowVertLines = False
            '
            'AddServiceIconColumn
            '
            Me.AddServiceIconColumn.ColumnEdit = Me.AddServiceIconRI
            Me.AddServiceIconColumn.Name = "AddServiceIconColumn"
            Me.AddServiceIconColumn.Options = CType(((DevExpress.XtraGrid.Columns.ColumnOptions.ReadOnly Or DevExpress.XtraGrid.Columns.ColumnOptions.FixedWidth) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.NonEditable), DevExpress.XtraGrid.Columns.ColumnOptions)
            Me.AddServiceIconColumn.VisibleIndex = 0
            Me.AddServiceIconColumn.Width = 24
            '
            'AddServiceIconRI
            '
            Me.AddServiceIconRI.AutoHeight = False
            Me.AddServiceIconRI.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
            Me.AddServiceIconRI.Items.AddRange(New Object() {New DevExpress.XtraEditors.Controls.ImageComboBoxItem("", Nothing, 6)})
            Me.AddServiceIconRI.Name = "AddServiceIconRI"
            '
            'AddServiceColumn
            '
            Me.AddServiceColumn.Caption = "Service"
            Me.AddServiceColumn.ColumnEdit = Me.AddServiceRI
            Me.AddServiceColumn.FieldName = "ServiceID"
            Me.AddServiceColumn.Name = "AddServiceColumn"
            Me.AddServiceColumn.VisibleIndex = 1
            Me.AddServiceColumn.Width = 150
            '
            'AddServiceRI
            '
            Me.AddServiceRI.AutoHeight = False
            Me.AddServiceRI.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
            Me.AddServiceRI.Name = "AddServiceRI"
            Me.AddServiceRI.PopupControl = Me.AsServicePopupControl
            '
            'AddPerformerColumn
            '
            Me.AddPerformerColumn.Caption = "Staff Member"
            Me.AddPerformerColumn.ColumnEdit = Me.AddPerformerRI
            Me.AddPerformerColumn.FieldName = "PerformerID"
            Me.AddPerformerColumn.Name = "AddPerformerColumn"
            Me.AddPerformerColumn.VisibleIndex = 2
            Me.AddPerformerColumn.Width = 150
            '
            'AddPerformerRI
            '
            Me.AddPerformerRI.AutoHeight = False
            Me.AddPerformerRI.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
            Me.AddPerformerRI.Name = "AddPerformerRI"
            Me.AddPerformerRI.PopupControl = Me.AsEmployeePopupControl
            '
            'AddPrice
            '
            Me.AddPrice.Caption = "Cost"
            Me.AddPrice.DisplayFormat.FormatString = "c2"
            Me.AddPrice.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric
            Me.AddPrice.FieldName = "ServiceCost"
            Me.AddPrice.Name = "AddPrice"
            Me.AddPrice.Options = CType(((((DevExpress.XtraGrid.Columns.ColumnOptions.CanMoved Or DevExpress.XtraGrid.Columns.ColumnOptions.CanResized) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.CanSorted) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.CanFocused) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.ShowInCustomizationForm), DevExpress.XtraGrid.Columns.ColumnOptions)
            Me.AddPrice.VisibleIndex = 3
            '
            'ResetClientButton
            '
            Me.ResetClientButton.Location = New System.Drawing.Point(376, 12)
            Me.ResetClientButton.Name = "ResetClientButton"
            Me.ResetClientButton.Size = New System.Drawing.Size(96, 23)
            Me.ResetClientButton.TabIndex = 2
            Me.ResetClientButton.Text = "&Reset"
            '
            'ServiceGrid
            '
            Me.ServiceGrid.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                        Or System.Windows.Forms.AnchorStyles.Left) _
                        Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
            '
            'ServiceGrid.EmbeddedNavigator
            '
            Me.ServiceGrid.EmbeddedNavigator.Buttons.Append.Enabled = False
            Me.ServiceGrid.EmbeddedNavigator.Buttons.Edit.Enabled = False
            Me.ServiceGrid.EmbeddedNavigator.Buttons.First.Enabled = False
            Me.ServiceGrid.EmbeddedNavigator.Buttons.Last.Enabled = False
            Me.ServiceGrid.EmbeddedNavigator.Buttons.Next.Enabled = False
            Me.ServiceGrid.EmbeddedNavigator.Buttons.NextPage.Enabled = False
            Me.ServiceGrid.EmbeddedNavigator.Buttons.Prev.Enabled = False
            Me.ServiceGrid.EmbeddedNavigator.Buttons.PrevPage.Enabled = False
            Me.ServiceGrid.EmbeddedNavigator.Name = ""
            Me.ServiceGrid.Location = New System.Drawing.Point(8, 40)
            Me.ServiceGrid.MainView = Me.ServiceView
            Me.ServiceGrid.Name = "ServiceGrid"
            Me.ServiceGrid.RepositoryItems.AddRange(New DevExpress.XtraEditors.Repository.RepositoryItem() {Me.IconRI, Me.SelectedRI})
            Me.ServiceGrid.Size = New System.Drawing.Size(472, 152)
            Me.ServiceGrid.TabIndex = 3
            Me.ServiceGrid.Text = "ServiceGrid"
            '
            'ServiceView
            '
            Me.ServiceView.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.SelectedColumn, Me.IconColumn, Me.NameColumn, Me.TypeColumn, Me.CostColumn})
            Me.ServiceView.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus
            Me.ServiceView.GridControl = Me.ServiceGrid
            Me.ServiceView.GroupFormat = "{1}"
            Me.ServiceView.Name = "ServiceView"
            Me.ServiceView.OptionsBehavior.AutoSelectAllInEditor = False
            Me.ServiceView.OptionsBehavior.AutoUpdateTotalSummary = False
            Me.ServiceView.OptionsDetail.EnableMasterViewMode = False
            Me.ServiceView.OptionsView.ShowGroupPanel = False
            Me.ServiceView.OptionsView.ShowIndicator = False
            Me.ServiceView.OptionsView.ShowVertLines = False
            '
            'SelectedColumn
            '
            Me.SelectedColumn.ColumnEdit = Me.SelectedRI
            Me.SelectedColumn.FieldName = "Selected"
            Me.SelectedColumn.Name = "SelectedColumn"
            Me.SelectedColumn.Options = CType(((DevExpress.XtraGrid.Columns.ColumnOptions.CanSorted Or DevExpress.XtraGrid.Columns.ColumnOptions.FixedWidth) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.CanFocused), DevExpress.XtraGrid.Columns.ColumnOptions)
            Me.SelectedColumn.VisibleIndex = 0
            Me.SelectedColumn.Width = 20
            '
            'SelectedRI
            '
            Me.SelectedRI.AutoHeight = False
            Me.SelectedRI.FullFocusRect = True
            Me.SelectedRI.Name = "SelectedRI"
            '
            'IconColumn
            '
            Me.IconColumn.ColumnEdit = Me.IconRI
            Me.IconColumn.Name = "IconColumn"
            Me.IconColumn.Options = CType(((DevExpress.XtraGrid.Columns.ColumnOptions.ReadOnly Or DevExpress.XtraGrid.Columns.ColumnOptions.FixedWidth) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.NonEditable), DevExpress.XtraGrid.Columns.ColumnOptions)
            Me.IconColumn.VisibleIndex = 1
            Me.IconColumn.Width = 24
            '
            'IconRI
            '
            Me.IconRI.AutoHeight = False
            Me.IconRI.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
            Me.IconRI.Items.AddRange(New Object() {New DevExpress.XtraEditors.Controls.ImageComboBoxItem("", Nothing, 6)})
            Me.IconRI.Name = "IconRI"
            '
            'NameColumn
            '
            Me.NameColumn.Caption = "Service"
            Me.NameColumn.FieldName = "ServiceName"
            Me.NameColumn.Name = "NameColumn"
            Me.NameColumn.Options = CType(((((((((DevExpress.XtraGrid.Columns.ColumnOptions.CanFiltered Or DevExpress.XtraGrid.Columns.ColumnOptions.CanMoved) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.CanGrouped) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.CanResized) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.CanSorted) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.ReadOnly) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.CanFocused) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.ShowInCustomizationForm) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.NonEditable), DevExpress.XtraGrid.Columns.ColumnOptions)
            Me.NameColumn.VisibleIndex = 2
            Me.NameColumn.Width = 111
            '
            'TypeColumn
            '
            Me.TypeColumn.Caption = "Type"
            Me.TypeColumn.FieldName = "ServiceType"
            Me.TypeColumn.Name = "TypeColumn"
            Me.TypeColumn.Options = CType(((((((((DevExpress.XtraGrid.Columns.ColumnOptions.CanFiltered Or DevExpress.XtraGrid.Columns.ColumnOptions.CanMoved) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.CanGrouped) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.CanResized) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.CanSorted) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.ReadOnly) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.CanFocused) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.ShowInCustomizationForm) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.NonEditable), DevExpress.XtraGrid.Columns.ColumnOptions)
            Me.TypeColumn.VisibleIndex = 3
            Me.TypeColumn.Width = 111
            '
            'CostColumn
            '
            Me.CostColumn.Caption = "Cost"
            Me.CostColumn.DisplayFormat.FormatString = "c2"
            Me.CostColumn.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric
            Me.CostColumn.FieldName = "ServiceCost"
            Me.CostColumn.Name = "CostColumn"
            Me.CostColumn.VisibleIndex = 4
            Me.CostColumn.Width = 116
            '
            'ClientLabel
            '
            Me.ClientLabel.Location = New System.Drawing.Point(8, 16)
            Me.ClientLabel.Name = "ClientLabel"
            Me.ClientLabel.Size = New System.Drawing.Size(80, 16)
            Me.ClientLabel.TabIndex = 0
            Me.ClientLabel.Text = "&Client:"
            '
            'ClientControl
            '
            Me.ClientControl.EditValue = Nothing
            Me.ClientControl.Location = New System.Drawing.Point(88, 14)
            Me.ClientControl.Name = "ClientControl"
            Me.ClientControl.Size = New System.Drawing.Size(272, 20)
            Me.ClientControl.TabIndex = 1
            '
            'TabPageProducts
            '
            Me.TabPageProducts.Controls.Add(Me.SoldByLabel)
            Me.TabPageProducts.Controls.Add(Me.EmployeeControl)
            Me.TabPageProducts.Controls.Add(Me.RemoveButton)
            Me.TabPageProducts.Controls.Add(Me.AddButton)
            Me.TabPageProducts.Controls.Add(Me.SelectedProductGrid)
            Me.TabPageProducts.Controls.Add(Me.AvailableProductGrid)
            Me.TabPageProducts.Location = New System.Drawing.Point(4, 22)
            Me.TabPageProducts.Name = "TabPageProducts"
            Me.TabPageProducts.Size = New System.Drawing.Size(488, 366)
            Me.TabPageProducts.TabIndex = 1
            Me.TabPageProducts.Text = "Products"
            Me.TabPageProducts.Visible = False
            '
            'SoldByLabel
            '
            Me.SoldByLabel.Location = New System.Drawing.Point(16, 10)
            Me.SoldByLabel.Name = "SoldByLabel"
            Me.SoldByLabel.Size = New System.Drawing.Size(56, 16)
            Me.SoldByLabel.TabIndex = 0
            Me.SoldByLabel.Text = "&Sold by:"
            '
            'EmployeeControl
            '
            Me.EmployeeControl.EditValue = Nothing
            Me.EmployeeControl.Location = New System.Drawing.Point(72, 8)
            Me.EmployeeControl.Name = "EmployeeControl"
            Me.EmployeeControl.Size = New System.Drawing.Size(304, 20)
            Me.EmployeeControl.TabIndex = 1
            '
            'RemoveButton
            '
            Me.RemoveButton.FlatStyle = System.Windows.Forms.FlatStyle.System
            Me.RemoveButton.Location = New System.Drawing.Point(232, 200)
            Me.RemoveButton.Name = "RemoveButton"
            Me.RemoveButton.Size = New System.Drawing.Size(24, 24)
            Me.RemoveButton.TabIndex = 4
            Me.RemoveButton.Text = ">"
            '
            'AddButton
            '
            Me.AddButton.FlatStyle = System.Windows.Forms.FlatStyle.System
            Me.AddButton.Location = New System.Drawing.Point(232, 160)
            Me.AddButton.Name = "AddButton"
            Me.AddButton.Size = New System.Drawing.Size(24, 24)
            Me.AddButton.TabIndex = 3
            Me.AddButton.Text = "<"
            '
            'SelectedProductGrid
            '
            Me.SelectedProductGrid.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                        Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
            '
            'SelectedProductGrid.EmbeddedNavigator
            '
            Me.SelectedProductGrid.EmbeddedNavigator.Name = ""
            Me.SelectedProductGrid.Location = New System.Drawing.Point(8, 40)
            Me.SelectedProductGrid.MainView = Me.SelectedProductView
            Me.SelectedProductGrid.Name = "SelectedProductGrid"
            Me.SelectedProductGrid.RepositoryItems.AddRange(New DevExpress.XtraEditors.Repository.RepositoryItem() {Me.SIconRI, Me.ProductCostRI})
            Me.SelectedProductGrid.Size = New System.Drawing.Size(216, 312)
            Me.SelectedProductGrid.TabIndex = 2
            Me.SelectedProductGrid.Text = "SelectedProductGrid"
            '
            'SelectedProductView
            '
            Me.SelectedProductView.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.SIconColumn, Me.SLabelColumn, Me.STypeColumn, Me.SFamilyColumn, Me.SCostColunm})
            Me.SelectedProductView.GridControl = Me.SelectedProductGrid
            Me.SelectedProductView.GroupFormat = "{1}"
            Me.SelectedProductView.Name = "SelectedProductView"
            Me.SelectedProductView.OptionsDetail.EnableMasterViewMode = False
            Me.SelectedProductView.OptionsView.ShowGroupPanel = False
            Me.SelectedProductView.OptionsView.ShowIndicator = False
            Me.SelectedProductView.OptionsView.ShowVertLines = False
            '
            'SIconColumn
            '
            Me.SIconColumn.ColumnEdit = Me.SIconRI
            Me.SIconColumn.Name = "SIconColumn"
            Me.SIconColumn.Options = CType(((DevExpress.XtraGrid.Columns.ColumnOptions.ReadOnly Or DevExpress.XtraGrid.Columns.ColumnOptions.FixedWidth) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.NonEditable), DevExpress.XtraGrid.Columns.ColumnOptions)
            Me.SIconColumn.VisibleIndex = 0
            Me.SIconColumn.Width = 20
            '
            'SIconRI
            '
            Me.SIconRI.AutoHeight = False
            Me.SIconRI.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
            Me.SIconRI.Items.AddRange(New Object() {New DevExpress.XtraEditors.Controls.ImageComboBoxItem("", Nothing, 5)})
            Me.SIconRI.Name = "SIconRI"
            '
            'SLabelColumn
            '
            Me.SLabelColumn.Caption = "Label"
            Me.SLabelColumn.FieldName = "Label"
            Me.SLabelColumn.Name = "SLabelColumn"
            Me.SLabelColumn.Options = CType((((((((DevExpress.XtraGrid.Columns.ColumnOptions.CanFiltered Or DevExpress.XtraGrid.Columns.ColumnOptions.CanMoved) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.CanResized) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.CanSorted) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.ReadOnly) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.CanFocused) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.ShowInCustomizationForm) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.NonEditable), DevExpress.XtraGrid.Columns.ColumnOptions)
            Me.SLabelColumn.VisibleIndex = 1
            Me.SLabelColumn.Width = 155
            '
            'STypeColumn
            '
            Me.STypeColumn.Caption = "Type"
            Me.STypeColumn.FieldName = "Type"
            Me.STypeColumn.Name = "STypeColumn"
            Me.STypeColumn.Options = CType(((((((((DevExpress.XtraGrid.Columns.ColumnOptions.CanFiltered Or DevExpress.XtraGrid.Columns.ColumnOptions.CanMoved) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.CanGrouped) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.CanResized) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.CanSorted) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.ReadOnly) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.CanFocused) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.ShowInCustomizationForm) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.NonEditable), DevExpress.XtraGrid.Columns.ColumnOptions)
            Me.STypeColumn.Width = 47
            '
            'SFamilyColumn
            '
            Me.SFamilyColumn.Caption = "Family"
            Me.SFamilyColumn.FieldName = "Family"
            Me.SFamilyColumn.Name = "SFamilyColumn"
            Me.SFamilyColumn.Options = CType(((((((((DevExpress.XtraGrid.Columns.ColumnOptions.CanFiltered Or DevExpress.XtraGrid.Columns.ColumnOptions.CanMoved) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.CanGrouped) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.CanResized) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.CanSorted) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.ReadOnly) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.CanFocused) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.ShowInCustomizationForm) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.NonEditable), DevExpress.XtraGrid.Columns.ColumnOptions)
            Me.SFamilyColumn.Width = 47
            '
            'SCostColunm
            '
            Me.SCostColunm.Caption = "Cost"
            Me.SCostColunm.ColumnEdit = Me.ProductCostRI
            Me.SCostColunm.DisplayFormat.FormatString = "c2"
            Me.SCostColunm.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric
            Me.SCostColunm.FieldName = "SuggestedPrice"
            Me.SCostColunm.Name = "SCostColunm"
            Me.SCostColunm.Options = CType(((((DevExpress.XtraGrid.Columns.ColumnOptions.CanMoved Or DevExpress.XtraGrid.Columns.ColumnOptions.CanResized) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.CanSorted) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.CanFocused) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.ShowInCustomizationForm), DevExpress.XtraGrid.Columns.ColumnOptions)
            Me.SCostColunm.VisibleIndex = 2
            Me.SCostColunm.Width = 50
            '
            'ProductCostRI
            '
            Me.ProductCostRI.AutoHeight = False
            Me.ProductCostRI.DisplayFormat.FormatString = "c2"
            Me.ProductCostRI.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric
            Me.ProductCostRI.EditFormat.FormatString = "f2"
            Me.ProductCostRI.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric
            Me.ProductCostRI.Name = "ProductCostRI"
            '
            'AvailableProductGrid
            '
            Me.AvailableProductGrid.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                        Or System.Windows.Forms.AnchorStyles.Left) _
                        Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
            '
            'AvailableProductGrid.EmbeddedNavigator
            '
            Me.AvailableProductGrid.EmbeddedNavigator.Name = ""
            Me.AvailableProductGrid.Location = New System.Drawing.Point(264, 40)
            Me.AvailableProductGrid.MainView = Me.AvailableProductView
            Me.AvailableProductGrid.Name = "AvailableProductGrid"
            Me.AvailableProductGrid.RepositoryItems.AddRange(New DevExpress.XtraEditors.Repository.RepositoryItem() {Me.AIconRI})
            Me.AvailableProductGrid.Size = New System.Drawing.Size(218, 312)
            Me.AvailableProductGrid.TabIndex = 5
            Me.AvailableProductGrid.Text = "AvailableProductGrid"
            '
            'AvailableProductView
            '
            Me.AvailableProductView.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.AIconColumn, Me.ALabelColumn, Me.ATypeColumn, Me.AFamilyFamily, Me.ACostColumn, Me.AStockColumn})
            Me.AvailableProductView.GridControl = Me.AvailableProductGrid
            Me.AvailableProductView.GroupFormat = "{1}"
            Me.AvailableProductView.Name = "AvailableProductView"
            Me.AvailableProductView.OptionsBehavior.Editable = False
            Me.AvailableProductView.OptionsDetail.EnableMasterViewMode = False
            Me.AvailableProductView.OptionsView.ShowIndicator = False
            Me.AvailableProductView.OptionsView.ShowVertLines = False
            '
            'AIconColumn
            '
            Me.AIconColumn.ColumnEdit = Me.AIconRI
            Me.AIconColumn.Name = "AIconColumn"
            Me.AIconColumn.Options = CType(((DevExpress.XtraGrid.Columns.ColumnOptions.ReadOnly Or DevExpress.XtraGrid.Columns.ColumnOptions.FixedWidth) _
                        Or DevExpress.XtraGrid.Columns.ColumnOptions.NonEditable), DevExpress.XtraGrid.Columns.ColumnOptions)
            Me.AIconColumn.VisibleIndex = 0
            Me.AIconColumn.Width = 20
            '
            'AIconRI
            '
            Me.AIconRI.AutoHeight = False
            Me.AIconRI.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
            Me.AIconRI.Items.AddRange(New Object() {New DevExpress.XtraEditors.Controls.ImageComboBoxItem("", Nothing, 5)})
            Me.AIconRI.Name = "AIconRI"
            '
            'ALabelColumn
            '
            Me.ALabelColumn.Caption = "Label"
            Me.ALabelColumn.FieldName = "Label"
            Me.ALabelColumn.Name = "ALabelColumn"
            Me.ALabelColumn.VisibleIndex = 1
            Me.ALabelColumn.Width = 47
            '
            'ATypeColumn
            '
            Me.ATypeColumn.Caption = "Type"
            Me.ATypeColumn.FieldName = "Type"
            Me.ATypeColumn.GroupIndex = 0
            Me.ATypeColumn.Name = "ATypeColumn"
            Me.ATypeColumn.SortIndex = 0
            Me.ATypeColumn.SortOrder = DevExpress.Data.ColumnSortOrder.Ascending
            Me.ATypeColumn.Width = 47
            '
            'AFamilyFamily
            '
            Me.AFamilyFamily.Caption = "Family"
            Me.AFamilyFamily.FieldName = "Family"
            Me.AFamilyFamily.Name = "AFamilyFamily"
            Me.AFamilyFamily.VisibleIndex = 2
            Me.AFamilyFamily.Width = 47
            '
            'ACostColumn
            '
            Me.ACostColumn.Caption = "Cost"
            Me.ACostColumn.DisplayFormat.FormatString = "c2"
            Me.ACostColumn.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric
            Me.ACostColumn.FieldName = "Price"
            Me.ACostColumn.Name = "ACostColumn"
            Me.ACostColumn.VisibleIndex = 3
            Me.ACostColumn.Width = 53
            '
            'AStockColumn
            '
            Me.AStockColumn.Caption = "Stock"
            Me.AStockColumn.FieldName = "Stock"
            Me.AStockColumn.Name = "AStockColumn"
            Me.AStockColumn.VisibleIndex = 4
            '
            'TabPagePayments
            '
            Me.TabPagePayments.Controls.Add(Me.PaymentGrid)
            Me.TabPagePayments.Location = New System.Drawing.Point(4, 22)
            Me.TabPagePayments.Name = "TabPagePayments"
            Me.TabPagePayments.Size = New System.Drawing.Size(488, 366)
            Me.TabPagePayments.TabIndex = 2
            Me.TabPagePayments.Text = "Payments"
            Me.TabPagePayments.Visible = False
            '
            'PaymentGrid
            '
            Me.PaymentGrid.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                        Or System.Windows.Forms.AnchorStyles.Left) _
                        Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
            '
            'PaymentGrid.EmbeddedNavigator
            '
            Me.PaymentGrid.EmbeddedNavigator.Buttons.First.Visible = False
            Me.PaymentGrid.EmbeddedNavigator.Buttons.Last.Visible = False
            Me.PaymentGrid.EmbeddedNavigator.Buttons.Next.Visible = False
            Me.PaymentGrid.EmbeddedNavigator.Buttons.NextPage.Visible = False
            Me.PaymentGrid.EmbeddedNavigator.Buttons.Prev.Visible = False
            Me.PaymentGrid.EmbeddedNavigator.Buttons.PrevPage.Visible = False
            Me.PaymentGrid.EmbeddedNavigator.Name = ""
            Me.PaymentGrid.Location = New System.Drawing.Point(8, 8)
            Me.PaymentGrid.MainView = Me.PaymentView
            Me.PaymentGrid.Name = "PaymentGrid"
            Me.PaymentGrid.RepositoryItems.AddRange(New DevExpress.XtraEditors.Repository.RepositoryItem() {Me.PSumRI, Me.PTypeRI, Me.PCardRI})
            Me.PaymentGrid.Size = New System.Drawing.Size(472, 348)
            Me.PaymentGrid.TabIndex = 0
            Me.PaymentGrid.Text = "PaymentGrid"
            Me.PaymentGrid.UseEmbeddedNavigator = True
            '
            'PaymentView
            '
            Me.PaymentView.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.PTypeColumn, Me.PCardColumn, Me.PSumColumn})
            Me.PaymentView.GridControl = Me.PaymentGrid
            Me.PaymentView.Name = "PaymentView"
            Me.PaymentView.OptionsDetail.EnableMasterViewMode = False
            Me.PaymentView.OptionsView.ShowGroupPanel = False
            Me.PaymentView.OptionsView.ShowNewItemRow = True
            Me.PaymentView.OptionsView.ShowVertLines = False
            '
            'PTypeColumn
            '
            Me.PTypeColumn.Caption = "Type"
            Me.PTypeColumn.ColumnEdit = Me.PTypeRI
            Me.PTypeColumn.FieldName = "PaymentType"
            Me.PTypeColumn.Name = "PTypeColumn"
            Me.PTypeColumn.VisibleIndex = 0
            Me.PTypeColumn.Width = 200
            '
            'PTypeRI
            '
            Me.PTypeRI.Items.AddRange(New DevExpress.XtraEditors.Controls.RadioGroupItem() {New DevExpress.XtraEditors.Controls.RadioGroupItem(CType(0, Byte), "Cash"), New DevExpress.XtraEditors.Controls.RadioGroupItem(CType(1, Byte), "Cheque"), New DevExpress.XtraEditors.Controls.RadioGroupItem(CType(2, Byte), "Card")})
            Me.PTypeRI.Name = "PTypeRI"
            '
            'PCardColumn
            '
            Me.PCardColumn.Caption = "Card"
            Me.PCardColumn.ColumnEdit = Me.PCardRI
            Me.PCardColumn.FieldName = "CardName"
            Me.PCardColumn.Name = "PCardColumn"
            Me.PCardColumn.VisibleIndex = 1
            Me.PCardColumn.Width = 200
            '
            'PCardRI
            '
            Me.PCardRI.AutoHeight = False
            Me.PCardRI.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
            Me.PCardRI.Items.AddRange(New Object() {"Electron", "Visa", "Delta", "Master Card", "Amex", "Switch", "Gift Certificate", "Other"})
            Me.PCardRI.Name = "PCardRI"
            Me.PCardRI.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor
            '
            'PSumColumn
            '
            Me.PSumColumn.Caption = "Amount"
            Me.PSumColumn.ColumnEdit = Me.PSumRI
            Me.PSumColumn.FieldName = "PaymentSumm"
            Me.PSumColumn.Name = "PSumColumn"
            Me.PSumColumn.VisibleIndex = 2
            Me.PSumColumn.Width = 70
            '
            'PSumRI
            '
            Me.PSumRI.AutoHeight = False
            Me.PSumRI.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
            Me.PSumRI.DisplayFormat.FormatString = "c2"
            Me.PSumRI.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric
            Me.PSumRI.Name = "PSumRI"
            '
            'LeftBox
            '
            Me.LeftBox.EditValue = 0
            Me.LeftBox.Location = New System.Drawing.Point(200, 72)
            Me.LeftBox.Name = "LeftBox"
            '
            'LeftBox.Properties
            '
            Me.LeftBox.Properties.DisplayFormat.FormatString = "c2"
            Me.LeftBox.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric
            Me.LeftBox.Properties.EditFormat.FormatString = "c2"
            Me.LeftBox.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric
            Me.LeftBox.Properties.Enabled = False
            Me.LeftBox.Properties.ReadOnly = True
            Me.LeftBox.Properties.StyleDisabled = New DevExpress.Utils.ViewStyle("ControlStyleDisabled", Nothing, New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(204, Byte)), "", DevExpress.Utils.StyleOptions.StyleEnabled, True, False, False, DevExpress.Utils.HorzAlignment.Default, DevExpress.Utils.VertAlignment.Center, Nothing, System.Drawing.SystemColors.Window, System.Drawing.SystemColors.WindowText)
            Me.LeftBox.Size = New System.Drawing.Size(72, 20)
            Me.LeftBox.TabIndex = 6
            '
            'LeftLabel
            '
            Me.LeftLabel.Location = New System.Drawing.Point(200, 58)
            Me.LeftLabel.Name = "LeftLabel"
            Me.LeftLabel.Size = New System.Drawing.Size(64, 16)
            Me.LeftLabel.TabIndex = 5
            Me.LeftLabel.Text = "Left to Paid:"
            '
            'ErrorProvider
            '
            Me.ErrorProvider.ContainerControl = Me
            '
            'ChangeBox
            '
            Me.ChangeBox.EditValue = 0
            Me.ChangeBox.Location = New System.Drawing.Point(296, 72)
            Me.ChangeBox.Name = "ChangeBox"
            '
            'ChangeBox.Properties
            '
            Me.ChangeBox.Properties.DisplayFormat.FormatString = "c2"
            Me.ChangeBox.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric
            Me.ChangeBox.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric
            Me.ChangeBox.Properties.Enabled = False
            Me.ChangeBox.Properties.ReadOnly = True
            Me.ChangeBox.Properties.StyleDisabled = New DevExpress.Utils.ViewStyle("ControlStyleDisabled", Nothing, New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(204, Byte)), "", DevExpress.Utils.StyleOptions.StyleEnabled, True, False, False, DevExpress.Utils.HorzAlignment.Default, DevExpress.Utils.VertAlignment.Center, Nothing, System.Drawing.SystemColors.Window, System.Drawing.SystemColors.WindowText)
            Me.ChangeBox.Size = New System.Drawing.Size(72, 20)
            Me.ChangeBox.TabIndex = 8
            '
            'Label1
            '
            Me.Label1.Location = New System.Drawing.Point(296, 56)
            Me.Label1.Name = "Label1"
            Me.Label1.Size = New System.Drawing.Size(64, 16)
            Me.Label1.TabIndex = 7
            Me.Label1.Text = "Change:"
            '
            'BillForm
            '
            Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
            Me.ClientSize = New System.Drawing.Size(496, 506)
            Me.Controls.Add(Me.ChangeBox)
            Me.Controls.Add(Me.Label1)
            Me.Controls.Add(Me.LeftBox)
            Me.Controls.Add(Me.LeftLabel)
            Me.Controls.Add(Me.PaidBox)
            Me.Controls.Add(Me.PaidLabel)
            Me.Controls.Add(Me.CostBox)
            Me.Controls.Add(Me.AmountLabel)
            Me.Controls.Add(Me.Tabs)
            Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
            Me.MinimumSize = New System.Drawing.Size(500, 540)
            Me.Name = "BillForm"
            Me.Text = "New Bill"
            Me.Controls.SetChildIndex(Me.Tabs, 0)
            Me.Controls.SetChildIndex(Me.AmountLabel, 0)
            Me.Controls.SetChildIndex(Me.CostBox, 0)
            Me.Controls.SetChildIndex(Me.PaidLabel, 0)
            Me.Controls.SetChildIndex(Me.PaidBox, 0)
            Me.Controls.SetChildIndex(Me.LeftLabel, 0)
            Me.Controls.SetChildIndex(Me.LeftBox, 0)
            Me.Controls.SetChildIndex(Me.Label1, 0)
            Me.Controls.SetChildIndex(Me.ChangeBox, 0)
            CType(Me.PaidBox.Properties, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.CostBox.Properties, System.ComponentModel.ISupportInitialize).EndInit()
            Me.Tabs.ResumeLayout(False)
            Me.TabPageServices.ResumeLayout(False)
            Me.AsServicePopupControl.ResumeLayout(False)
            Me.AsEmployeePopupControl.ResumeLayout(False)
            CType(Me.AsEmployeeGrid, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.AsEmployeeView, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.AsEmployeeIconRI, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.AsServiceGrid, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.AsServiceView, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.AsServiceIconRI, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.AdditionalServiceGrid, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.AdditionServiceView, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.AddServiceIconRI, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.AddServiceRI, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.AddPerformerRI, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.ServiceGrid, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.ServiceView, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.SelectedRI, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.IconRI, System.ComponentModel.ISupportInitialize).EndInit()
            Me.TabPageProducts.ResumeLayout(False)
            CType(Me.SelectedProductGrid, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.SelectedProductView, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.SIconRI, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.ProductCostRI, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.AvailableProductGrid, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.AvailableProductView, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.AIconRI, System.ComponentModel.ISupportInitialize).EndInit()
            Me.TabPagePayments.ResumeLayout(False)
            CType(Me.PaymentGrid, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.PaymentView, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.PTypeRI, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.PCardRI, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.PSumRI, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.LeftBox.Properties, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.ChangeBox.Properties, System.ComponentModel.ISupportInitialize).EndInit()
            Me.ResumeLayout(False)

        End Sub
#End Region

#Region " Data "
        Private mServiceList As ArrayList = New ArrayList
        Private mProductList As ArrayList = New ArrayList
        Private mAdditionalServiceDS As DataSetAppointments = New DataSetAppointments
        Private WithEvents dsPayments As DataSetBill.PaymentsDataTable
        Private ds As DataAccess.DataSetBill

        Public Shadows Property DataSource() As DataSetBill.Bill
            Get
                Return CType(MyBase.DataSource, DataSetBill.Bill)
            End Get
            Set(ByVal Value As DataSetBill.Bill)
                MyBase.DataSource = Value
            End Set
        End Property

        Protected Overrides Sub DoBinding()
            ResetProductList()
            ResetPaymentList()
            ResetServiceList()
            ResetAdditionalServiceList()

            'REQUESTED TO REMOVE: TTP #318
            'EmployeeControl.EditValue = AppDataLayer.Employees.FindByEmployeeID(DataSource.OperatorID)
            ClientControl.EditValue = AppDataLayer.Clients.FindByClientID(DataSource.ClientID)

            SuspendDataChangedEvents = True
            CostBox.EditValue = 0
            PaidBox.EditValue = 0
            UpdateCost()
            UpdatePayment()
            SuspendDataChangedEvents = False
        End Sub

        Public Overrides ReadOnly Property DocumentTitle() As String
            Get
                If DataSource.IsClientIDNull Then
                    Return Res.TitleBillNew
                Else
                    Return String.Format(Res.TitleBillClient, AppDataLayer.Clients.FindByClientID(DataSource.ClientID).FullName)
                End If
            End Get
        End Property

        Public Overrides ReadOnly Property Title() As String
            Get
                Return DocumentTitle
            End Get
        End Property
#End Region

#Region " Event Handlers  "
        Private Sub Form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            If DesignMode Then Return

            AvailableProductGrid.DataSource = New DataView(AppDataLayer.Products)
            AsServiceGrid.DataSource = New DataView(AppDataLayer.Services)
            AsEmployeeGrid.DataSource = New DataView(AppDataLayer.Employees)
            AsEmployeeActive.FilterInfo = New DevExpress.XtraGrid.Columns.ColumnFilterInfo("True")

            UpdateConfiguration()
        End Sub

        Private mHashColor As Hashtable = New Hashtable
        Private Sub AvailableProductView_CustomDrawCell(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs) Handles AvailableProductView.CustomDrawCell
            Dim p As DataSetData.Product = AvailableProductView.GetDataRow(e.RowHandle)


            If (p.Stock - p.CriticalStock <= 0) And AppConfig.IndicateCriticalStock Then
                If Not mHashColor.ContainsKey(e.Style) Then
                    mHashColor(e.Style) = e.Style.ForeColor
                End If
                e.Style.ForeColor = AppConfig.CriticalStockColor
            Else
                If mHashColor.ContainsKey(e.Style) Then
                    e.Style.ForeColor = CType(mHashColor(e.Style), Color)
                End If
            End If
        End Sub

        Private Sub ResetClientButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ResetClientButton.Click
            ClientControl.EditValue = Nothing
        End Sub

        Private mBillSaved As Boolean = False

        Private Sub BillForm_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
            If Not mBillSaved Then
                Do While mProductList.Count > 0
                    RemoveProduct(CType(mProductList(0), DataSetData.Product))
                Loop
            End If
        End Sub

#End Region

#Region " Life-Cycle Routines "
        Private mReceipt As Till.Receipt


        Protected Overrides Sub DoSaving()
            PaymentView.CloseEditor()

            mReceipt = New Till.Receipt
            mReceipt.SalonName = AppConfig.SalonName
            If ClientControl.EditValue Is Nothing Then
                mReceipt.CustomerName = Res.AppointmentSelectClient
            Else
                mReceipt.CustomerName = CType(ClientControl.EditValue, DataSetData.Client).FullName
            End If
            mReceipt.Time = Now
            AppDataLayer.DoInTransaction(AddressOf MakeBill)
            Try
                AppOpenTillAndPrintReceipt(mReceipt)
            Catch ex As Exception
                AppMessageBox(ex.Message, MsgBoxStyle.Critical)
            End Try

            mBillSaved = True
        End Sub

        Protected Overrides Function CreateNewRow() As DataRow
            ds = New DataSetBill
            dsPayments = ds.Payments

            Dim b As DataSetBill.Bill = ds.Bills.NewBill

            If Not Security.CurrentUser().Sys Then
                b.OperatorID = Security.CurrentUser.EmployeeID
            End If

            If Not CreationParameter Is Nothing Then
                Dim cID As Integer = CInt(CreationParameter)
                b.ClientID = cID
            End If

            Return b
        End Function

        '<System.Diagnostics.DebuggerStepThrough()> 
        Private Sub MakeBill()
            DataSource.CreationTime = Now()
            ds.Bills.AddBill(DataSource)
            AppDataLayer.UpdateBill(DataSource.Table)
            AppRaiseEvent(Me, New PhoenixEventArgs(DataSource, PhoenixEventCode.BizAdded))

            For Each bs As BillService In mServiceList
                If bs.Selected Then
                    Dim app As DataSetAppointments.Appointment = bs.Appointment
                    app.BillID = DataSource.BillID
                    bs.UpdateCost()
                    AppointmentHelper.UpdateAppointment(app, Me)
                    mReceipt.Services.Add(New Till.ReceiptItem(bs.ServiceName, bs.ServiceCost))
                End If
            Next

            Dim appDS As New DataSetAppointments
            For i As Integer = 0 To AdditionServiceView.RowCount - 1
                If Not AdditionServiceView.GetDataRow(i) Is Nothing Then
                    Dim ads As DataSetAppointments.Appointment = appDS.Appointments.NewAppointment
                    ads.BillID = DataSource.BillID
                    ads.ClientID = DataSource.ClientID
                    ads.CreationTime = Now
                    ads.ExpectedDuration = 0
                    ads.StartTime = Now
                    ads.FinishTime = Now
                    ads.OperatorID = Security.CurrentUser.EmployeeID
                    ads.PerformerID = AdditionServiceView.GetRowCellValue(i, AddPerformerColumn)
                    ads.ServiceCost = AdditionServiceView.GetRowCellValue(i, AddPrice)
                    ads.ServiceID = AdditionServiceView.GetRowCellValue(i, AddServiceColumn)
                    appDS.Appointments.AddAppointment(ads)

                    'Try
                    AppDataLayer.UpdateAppointment(ads)
                    'Catch ex As Exception

                    'End Try
                    mReceipt.Services.Add(New Till.ReceiptItem(AppDataLayer.Services.FindByServiceID(ads.ServiceID).Label, ads.ServiceCost))
                End If
            Next

            For Each p As DataSetData.Product In mProductList
                Dim bp As DataSetBill.BillProduct = ds.BillProducts.NewBillProduct
                bp.Bill = DataSource
                bp.Cost = p.SuggestedPrice
                bp.ProductID = p.ProductID
                ds.BillProducts.AddBillProduct(bp)
                AppDataLayer.UpdateProduct(p)
                mReceipt.Services.Add(New Till.ReceiptItem(p.Label, p.Price))
            Next
            AppDataLayer.UpdateBillProducts(ds.BillProducts)

            Dim lds As New DataSetBill
            lds.EnforceConstraints = False
            For i As Integer = 0 To PaymentView.RowCount - 1
                Dim p As DataSetBill.Payment = PaymentView.GetDataRow(i)
                If Not p Is Nothing Then
                    Dim newp As DataSetBill.Payment = lds.Payments.NewPayment
                    newp.ItemArray = p.ItemArray
                    newp.BillID = DataSource.BillID

                    '                    p.Bill = DataSource
                    lds.Payments.AddPayment(newp)

                    Select Case newp.PaymentType
                        Case 0 ' Cash
                            mReceipt.Cash += newp.PaymentSumm
                        Case 1 ' Cheque
                            mReceipt.Cheque += newp.PaymentSumm
                        Case 2 ' Card
                            mReceipt.Card += newp.PaymentSumm
                    End Select
                    mReceipt.Total += newp.PaymentSumm
                    AppDataLayer.UpdateBillPayment(newp)
                End If
            Next

            Try
                Dim change As Double = ChangeBox.EditValue
                If change <> 0 Then
                    Dim p As DataSetBill.Payment = lds.Payments.NewPayment
                    p.BillID = DataSource.BillID
                    p.PaymentType = 0 ' Cash
                    p.PaymentSumm = -change
                    mReceipt.Total += p.PaymentSumm
                    mReceipt.Cash += p.PaymentSumm
                    lds.Payments.AddPayment(p)
                    AppDataLayer.UpdateBillPayment(p)
                End If
            Catch ex As Exception
                AppMessageBox(ex.Message)
            End Try


            Dim apps() As DataSetAppointments.Appointment = appDS.Appointments.Select
            For i As Integer = 0 To apps.Length - 1
                Dim ads As DataSetAppointments.Appointment = apps(i)
                ads.Delete()
                AppDataLayer.UpdateAppointment(ads)
            Next

            Dim cl As DataSetData.Client = AppDataLayer.Clients.FindByClientID(DataSource.ClientID)
            If Not cl Is Nothing Then
                cl.InOffice = False
                ClientHelper.UpdateClient(cl, Me, True)
            End If
        End Sub

#End Region

#Region " Preferences "
        Protected Overrides Sub LoadPreferences(ByVal pref As Preferences.IPreferencesNode)
            MyBase.LoadPreferences(pref)

            Dim node As IPreferencesNode
            Dim ba As Byte()

            ' ClientControl
            node = pref.GetNodeForPath(ClientControl.Name)
            ba = node.GetByteArray("Grid", Nothing) : If Not ba Is Nothing Then ClientControl.GridView.RestoreLayoutFromStream(New MemoryStream(ba))
            ClientControl.PopupWindow.Width = node.GetInt32("PopupWidth", ClientControl.PopupWindow.Width)
            ClientControl.PopupWindow.Height = node.GetInt32("PopupHeight", ClientControl.PopupWindow.Height)
            ClientControl.UpdateConfiguration()
            AsServicePopupControl.Width = node.GetInt32("AsServicePopupControlWidth", AsServicePopupControl.Width)
            AsServicePopupControl.Height = node.GetInt32("AsServicePopupControlHeight", AsServicePopupControl.Height)
            AsEmployeePopupControl.Width = node.GetInt32("AsEmployeePopupControlWidth", AsEmployeePopupControl.Width)
            AsEmployeePopupControl.Height = node.GetInt32("AsEmployeePopupControlHeight", AsEmployeePopupControl.Height)

            ' ServiceGrid
            node = pref.GetNodeForPath(ServiceGrid.Name)
            ba = node.GetByteArray("ServiceGrid", Nothing) : If Not ba Is Nothing Then ServiceView.RestoreLayoutFromStream(New MemoryStream(ba))

            ' AdditionalServiceGrid
            node = pref.GetNodeForPath(AdditionalServiceGrid.Name)
            ba = node.GetByteArray("AdditionalServiceGrid", Nothing) : If Not ba Is Nothing Then AdditionServiceView.RestoreLayoutFromStream(New MemoryStream(ba))

            ' AsServiceGrid
            node = pref.GetNodeForPath(AsServiceGrid.Name)
            ba = node.GetByteArray("AsServiceGrid", Nothing) : If Not ba Is Nothing Then AsServiceView.RestoreLayoutFromStream(New MemoryStream(ba))

            ' AsEmployeeGrid
            node = pref.GetNodeForPath(AsEmployeeGrid.Name)
            ba = node.GetByteArray("AsEmployeeGrid", Nothing) : If Not ba Is Nothing Then AsEmployeeView.RestoreLayoutFromStream(New MemoryStream(ba))

            ' AvailableProductGrid
            node = pref.GetNodeForPath(AvailableProductGrid.Name)
            ba = node.GetByteArray("AvailableProductGrid", Nothing) : If Not ba Is Nothing Then AvailableProductView.RestoreLayoutFromStream(New MemoryStream(ba))

            ' SelectedProductGrid
            node = pref.GetNodeForPath(SelectedProductGrid.Name)
            ba = node.GetByteArray("SelectedProductGrid", Nothing) : If Not ba Is Nothing Then SelectedProductView.RestoreLayoutFromStream(New MemoryStream(ba))

            ' PaymentGrid
            node = pref.GetNodeForPath(PaymentGrid.Name)
            ba = node.GetByteArray("PaymentGrid", Nothing) : If Not ba Is Nothing Then PaymentView.RestoreLayoutFromStream(New MemoryStream(ba))
        End Sub

        Protected Overrides Sub SavePreferences(ByVal pref As Preferences.IPreferencesNode)
            Dim node As IPreferencesNode
            Dim ms As MemoryStream

            ' ClientControl
            node = pref.GetNodeForPath(ClientControl.Name)
            ms = New MemoryStream : ClientControl.GridView.SaveLayoutToStream(ms) : node.Item("Grid") = ms.ToArray()
            node("PopupWidth") = ClientControl.PopupWindow.Width
            node("PopupHeight") = ClientControl.PopupWindow.Height
            node("AsEmployeePopupControlWidth") = AsEmployeePopupControl.Width
            node("AsEmployeePopupControlHeight") = AsEmployeePopupControl.Height
            node("AsServicePopupControlWidth") = AsServicePopupControl.Width
            node("AsServicePopupControlHeight") = AsServicePopupControl.Height

            ' ServiceGrid
            node = pref.GetNodeForPath(ServiceGrid.Name)
            ms = New MemoryStream : ServiceView.SaveLayoutToStream(ms) : node.Item("ServiceGrid") = ms.ToArray()

            ' AdditionalServiceGrid
            node = pref.GetNodeForPath(AdditionalServiceGrid.Name)
            ms = New MemoryStream : AdditionServiceView.SaveLayoutToStream(ms) : node.Item("AdditionalServiceGrid") = ms.ToArray()

            ' AsServiceGrid
            node = pref.GetNodeForPath(AsServiceGrid.Name)
            ms = New MemoryStream : AsServiceView.SaveLayoutToStream(ms) : node.Item("AsServiceGrid") = ms.ToArray()

            ' AsEmployeeGrid
            node = pref.GetNodeForPath(AsEmployeeGrid.Name)
            ms = New MemoryStream : AsEmployeeView.SaveLayoutToStream(ms) : node.Item("AsEmployeeGrid") = ms.ToArray()

            ' AvailableProductGrid
            node = pref.GetNodeForPath(AvailableProductGrid.Name)
            ms = New MemoryStream : AvailableProductView.SaveLayoutToStream(ms) : node.Item("AvailableProductGrid") = ms.ToArray()

            ' SelectedProductGrid
            node = pref.GetNodeForPath(SelectedProductGrid.Name)
            ms = New MemoryStream : SelectedProductView.SaveLayoutToStream(ms) : node.Item("SelectedProductGrid") = ms.ToArray()

            ' PaymentGrid
            node = pref.GetNodeForPath(PaymentGrid.Name)
            ms = New MemoryStream : PaymentView.SaveLayoutToStream(ms) : node.Item("PaymentGrid") = ms.ToArray()

            MyBase.SavePreferences(pref)
        End Sub
#End Region

#Region " Data Exchange "
        Private Sub EmployeeControl_EditValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EmployeeControl.EditValueChanged
            If SuspendDataChangedEvents() Then Return

            If EmployeeControl.EditValue Is Nothing Then
                DataSource.SetOperatorIDNull()
            Else
                DataSource.OperatorID = CType(EmployeeControl.EditValue, DataSetData.Employee).EmployeeID
            End If
            ValidateEmployee()
        End Sub

        Private Sub AvailableProductView_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles AvailableProductView.MouseDown
            If e.Button <> MouseButtons.Left Then Return
            If e.Clicks < 2 Then Return

            AddButton_Click(AddButton, EventArgs.Empty)
        End Sub

        Private Sub AddButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddButton.Click
            If IsInvalidRowHandle(AvailableProductView.FocusedRowHandle) Then Return

            Dim p As Object = AvailableProductView.GetDataRow(AvailableProductView.FocusedRowHandle)
            If Not p Is Nothing Then
                AddProduct(CType(p, DataSetData.Product))
            End If
        End Sub


        Private Sub SelectedProductView_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles SelectedProductView.MouseDown
            If e.Button <> MouseButtons.Left Then Return
            If e.Clicks < 2 Then Return
            If IsInvalidRowHandle(SelectedProductView.FocusedRowHandle) Then Return

            RemoveButton_Click(RemoveButton, EventArgs.Empty)
        End Sub

        Private Sub RemoveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RemoveButton.Click
            Dim p As Object = SelectedProductView.GetRow(SelectedProductView.FocusedRowHandle)
            If Not p Is Nothing Then
                RemoveProduct(CType(p, DataSetData.Product))
            End If
        End Sub



        Private Sub SelectedRI_EditValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectedRI.EditValueChanged
            Dim bs As BillService = CType(ServiceView.GetRow(ServiceView.FocusedRowHandle()), BillService)

            bs.Selected = Not bs.Selected

            UpdateCost()
            UpdateEmployee()
        End Sub

        Private Sub ClientControl_EditValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClientControl.EditValueChanged
            If SuspendDataChangedEvents() Then Return

            If ClientControl.EditValue Is Nothing Then
                DataSource.SetClientIDNull()
            Else
                DataSource.ClientID = CType(ClientControl.EditValue, DataSetData.Client).ClientID
            End If

            Text = Title

            UpdateServiceList()
            ValidateClient()
        End Sub

        Private Sub UpdateServiceList()
            mServiceList.Clear()
            ServiceGrid.DataSource = Nothing

            If Not DataSource.IsClientIDNull Then
                Dim ntime As Date = Now
                Dim stime As Date = ntime.Date
                Dim ftime As Date = stime.AddDays(1).AddMinutes(-1)
                For Each app As DataSetAppointments.Appointment In AppDataLayer.GetClientAppointments(DataSource.ClientID, stime, ftime).Appointments
                    If app.IsBillIDNull Then
                        Dim bs As BillService = New BillService(app)
                        mServiceList.Add(bs)

                        'TTP #339: Mark all appointments for billing
                        'If DateTime.Compare(app.StartTime, ntime) < 0 Then
                        bs.Selected = True
                        'End If
                    End If
                Next
            End If

            ServiceGrid.DataSource = mServiceList

            UpdateCost()
            UpdateEmployee()
        End Sub

        Private Sub UpdateEmployee()
            'REQUESTED TO REMOVE: TTP #318
            'If AdditionServiceView.RowCount > 1 Then
            '    Dim v As Object = AdditionServiceView.GetRowCellValue(AdditionServiceView.RowCount - 2, AddPerformerColumn)
            '    If Not v Is DBNull.Value Then
            '        EmployeeControl.EditValue = AppDataLayer.Employees.FindByEmployeeID(CInt(v))
            '    End If
            'Else
            '    Dim lastApp As DataSetAppointments.Appointment

            '    For Each bs As BillService In mServiceList
            '        If bs.Selected Then
            '            If lastApp Is Nothing Then
            '                lastApp = bs.Appointment
            '            ElseIf lastApp.StartTime < bs.Appointment.StartTime Then
            '                lastApp = bs.Appointment
            '            End If
            '        End If
            '    Next

            '    If Not lastApp Is Nothing Then
            '        EmployeeControl.EditValue = AppDataLayer.Employees.FindByEmployeeID(lastApp.PerformerID)
            '    End If

            'End If

        End Sub

        Private Sub UpdateCost()
            Dim cost As Double = 0
            Dim left As Double = 0
            Dim change As Double = 0
            Dim paid As Double = CDbl(PaidBox.EditValue)

            For Each bs As BillService In mServiceList
                If bs.Selected Then
                    cost = cost + bs.ServiceCost
                End If
            Next

            For i As Integer = 0 To AdditionServiceView.RowCount - 1
                If Not AdditionServiceView.GetDataRow(i) Is Nothing Then
                    Dim v As Object = AdditionServiceView.GetRowCellValue(i, AddPrice)
                    If Not v Is DBNull.Value Then
                        cost = cost + Math.Round(v, 2)
                    End If
                End If
            Next

            For Each p As DataSetData.Product In mProductList
                cost = cost + CDbl(p.SuggestedPrice)
            Next

            CostBox.EditValue = Math.Round(cost, 2)

            CalculateMoney()


            If ErrorProvider.GetError(CostBox) <> String.Empty Then
                ValidateAmount()
            End If

            If Not SuspendDataChangedEvents Then
                DataSource.PaymentSumm = cost
            End If
        End Sub


        Private Sub CalculateMoney()
            Dim cost As Double = CDbl(CostBox.EditValue)
            Dim paid As Double = CDbl(PaidBox.EditValue)
            Dim left As Double = 0
            Dim change As Double = 0


            If cost > paid Then
                left = cost - paid
                change = 0
            Else
                left = 0
                change = paid - cost
            End If

            LeftBox.EditValue = Math.Round(left, 2)
            ChangeBox.EditValue = Math.Round(change, 2)
        End Sub

        Private Sub UpdatePayment()
            Dim paid As Double = 0

            For i As Integer = 0 To PaymentView.RowCount - 1
                If Not PaymentView.GetDataRow(i) Is Nothing Then
                    paid = paid + CDbl(PaymentView.GetRowCellValue(i, PSumColumn))
                End If
            Next

            PaidBox.EditValue = Math.Round(paid, 2)
            CalculateMoney()

            If ErrorProvider.GetError(LeftBox) <> String.Empty Then
                ValidatePaid()
            End If
        End Sub

        Private Sub ResetProductList()
            mProductList.Clear()
            SelectedProductGrid.DataSource = Nothing
        End Sub

        Private Sub ResetServiceList()
            mServiceList.Clear()
            ServiceGrid.DataSource = mServiceList
            ServiceGrid.RefreshDataSource()
        End Sub

        Private Sub ResetAdditionalServiceList()
            mAdditionalServiceDS.Appointments.Clear()
            AdditionalServiceGrid.DataSource = mAdditionalServiceDS
            AdditionalServiceGrid.DataMember = mAdditionalServiceDS.Appointments.TableName
            AdditionalServiceGrid.RefreshDataSource()
        End Sub

        Private Sub ResetPaymentList()
            PaymentGrid.DataSource = ds.Payments
            'PaymentGrid.RefreshDataSource()
        End Sub

        Private Sub AddProduct(ByVal p As DataSetData.Product)
            If (p.Stock <= 0) And AppConfig.StrongStockMode Then
                AppMessageBox(String.Format(Res.NoAvailableProductMessage, p.Label), MsgBoxStyle.Exclamation)
                Return
            End If

            If p.Stock > 0 Then
                p.Stock = p.Stock - 1
            End If

            p.SuggestedPrice = Math.Round(p.Price, 2)

            mProductList.Add(p)
            ValidateEmployee()
            UpdateCost()

            SelectedProductGrid.DataSource = mProductList
            SelectedProductGrid.RefreshDataSource()
        End Sub

        Private Sub RemoveProduct(ByVal p As DataSetData.Product)
            p.Stock = p.Stock + 1

            mProductList.Remove(p)
            ValidateEmployee()
            UpdateCost()

            SelectedProductGrid.DataSource = mProductList
            SelectedProductGrid.RefreshDataSource()
        End Sub

        Private Sub ServiceView_CellValueChanged(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs) Handles ServiceView.CellValueChanged
            If e.Column Is CostColumn Then
                Dim val As Decimal
                val = Math.Round(CDec(e.Value), 2)
                If val <> e.Value Then
                    ServiceView.SetRowCellValue(e.RowHandle, CostColumn, val)
                End If
            End If
            UpdateCost()
        End Sub


        Private Sub PaymentView_CellValueChanged(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs) Handles PaymentView.CellValueChanged
            If (e.Column Is PSumColumn) Then
                UpdatePayment()
            End If
        End Sub

        Private Sub dsPayments_PaymentDeleted(ByVal sender As Object, ByVal e As DataAccess.DataSetBill.PaymentChangeEvent) Handles dsPayments.PaymentDeleted
            UpdatePayment()
        End Sub
#End Region

#Region " Application Event Handlers "
        Protected Overrides Sub OnApplicationEvent(ByVal sender As Object, ByVal e As Events.PhoenixEventArgs)
            If e.EventCode = PhoenixEventCode.ConfigurationChanged Then
                UpdateConfiguration()
            ElseIf TypeOf e.EventData Is DataSetData.Client Then
                If (e.EventCode = PhoenixEventCode.BizRemoved) Then
                    Dim client As DataSetData.Client = e.EventData
                    If client.ClientID = DataSource.ClientID Then
                        DataSource.ClientID = 0
                        ClientControl.EditValue = Nothing
                    End If
                End If
            ElseIf TypeOf e.EventData Is DataSetData.Employee Then
                If (e.EventCode = PhoenixEventCode.BizRemoved) Then
                    Dim em As DataSetData.Employee = e.EventData
                    If em.EmployeeID = DataSource.OperatorID Then
                        DataSource.ClientID = 0
                        EmployeeControl.EditValue = Nothing
                    End If
                End If
            ElseIf TypeOf e.EventData Is DataSetData.Product Then
                If (e.EventCode = PhoenixEventCode.BizRemoved) Then
                    Dim prod As DataSetData.Product = e.EventData
                    For i As Integer = 0 To mProductList.Count - 1
                        If prod.ProductID = mProductList(i).ProductID Then
                            mProductList.RemoveAt(i)
                            i = i - 1
                        End If
                    Next
                    SelectedProductGrid.DataSource = mProductList
                    SelectedProductGrid.RefreshDataSource()
                End If
            End If
        End Sub


        Private Sub UpdateConfiguration()
            IconRI.SmallImages = AppSharedComponents.ListImages
            IconColumn.MinWidth = IconRI.SmallImages.ImageSize.Width + AppIconColumnPadding

            AIconRI.SmallImages = AppSharedComponents.ListImages
            AIconColumn.MinWidth = AIconRI.SmallImages.ImageSize.Width + AppIconColumnPadding

            SIconRI.SmallImages = AppSharedComponents.ListImages
            SIconColumn.MinWidth = SIconRI.SmallImages.ImageSize.Width + AppIconColumnPadding

            AsServiceIconRI.SmallImages = AppSharedComponents.ListImages
            AsServiceIcon.MinWidth = AsServiceIconRI.SmallImages.ImageSize.Width + AppIconColumnPadding

            AsEmployeeIconRI.SmallImages = AppSharedComponents.ListImages
            AsEmployeeIcon.MinWidth = AsServiceIconRI.SmallImages.ImageSize.Width + AppIconColumnPadding

            AddServiceIconRI.SmallImages = AppSharedComponents.ListImages
            AddServiceIconColumn.MinWidth = AddServiceIconRI.SmallImages.ImageSize.Width + AppIconColumnPadding
        End Sub

#End Region

#Region " Validation "

        Private Sub EmployeeControl_Validate(ByVal sender As Object, ByVal e As CancelEventArgs)
            ValidateEmployee()
        End Sub

        Private Function ValidateEmployee() As Boolean
            If (EmployeeControl.EditValue Is Nothing) And (mProductList.Count > 0) Then
                ErrorProvider.SetError(EmployeeControl, Res.BillEmployeeRequiredError)
                Return False
            Else
                ErrorProvider.SetError(EmployeeControl, String.Empty)
                Return True
            End If
        End Function


        Private Sub PaymentView_ValidateRow(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs) Handles PaymentView.ValidateRow
            e.Valid = ValidatePayment(e.RowHandle)
        End Sub

        Private Sub PaymentView_InvalidRowException(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.InvalidRowExceptionEventArgs) Handles PaymentView.InvalidRowException
            e.ExceptionMode = DevExpress.XtraEditors.Controls.ExceptionMode.NoAction
        End Sub


        Private Function ValidateClient() As Boolean
            If (ClientControl.EditValue Is Nothing) And (AdditionServiceView.RowCount > 1) Then
                ErrorProvider.SetError(ClientControl, Res.BillClientRequiredError)
                Return False
            Else
                ErrorProvider.SetError(ClientControl, String.Empty)
                Return True
            End If
        End Function

        Private Function ValidateAmount() As Boolean
            If CDbl(CostBox.EditValue) < 0 Then
                ErrorProvider.SetError(CostBox, Res.BillEmptyError)
                Return False
            Else
                ErrorProvider.SetError(CostBox, String.Empty)
                Return True
            End If
        End Function

        Private Function ValidatePaid() As Boolean
            If Math.Abs(CDbl(LeftBox.EditValue)) <> 0 Then
                ErrorProvider.SetError(LeftBox, Res.BillNotPaidError)
                Return False
            Else
                ErrorProvider.SetError(LeftBox, String.Empty)
                Return True
            End If
        End Function


        Private Function ValidatePayment(ByVal row As Integer) As Boolean
            If PaymentView.GetDataRow(row) Is Nothing Then Return True

            Dim r As Boolean = True

            PaymentView.SelectRow(r)
            'Checkign amount
            Dim sum As Double = PaymentView.GetRowCellValue(row, PSumColumn)
            If sum = 0.0 Then
                r = False
                PaymentView.SetColumnError(PSumColumn, Res.ErrorRequiredSumma)
            End If

            'Checking card...
            Dim type As Byte = PaymentView.GetRowCellValue(row, PTypeColumn)
            If type = 2 Then
                ' CARD
                Dim s As Object = PaymentView.GetRowCellValue(row, PCardColumn)
                If (s Is DBNull.Value) Or (s Is String.Empty) Then
                    r = False
                    PaymentView.SetColumnError(PCardColumn, Res.ErrorRequiredCardName)
                End If
            Else
                Dim s As Object = PaymentView.GetRowCellValue(row, PCardColumn)
                If Not s Is DBNull.Value Then
                    PaymentView.SetRowCellValue(row, PCardColumn, String.Empty)
                End If
            End If

            Return r
        End Function


        Private Function ValidatePayments() As Boolean
            Dim res As Boolean = True
            For i As Integer = 0 To PaymentView.RowCount - 1
                If Not ValidatePayment(i) Then
                    res = False
                End If
            Next
            Return res
        End Function


        Private Function ValidateAdditionalService(ByVal row As Integer) As Boolean
            If AdditionServiceView.GetDataRow(row) Is Nothing Then Return True

            Dim r As Boolean = True

            AdditionServiceView.SelectRow(row)

            If AdditionServiceView.GetRowCellValue(row, AddServiceColumn) Is DBNull.Value Then
                AdditionServiceView.SetColumnError(AddServiceColumn, Res.AppointmentServiceRequired)
                r = False
            Else
                AdditionServiceView.SetColumnError(AddServiceColumn, String.Empty)
            End If

            If AdditionServiceView.GetRowCellValue(row, AddPerformerColumn) Is DBNull.Value Then
                AdditionServiceView.SetColumnError(AddPerformerColumn, Res.AppointmentStaffMemberRequired)
                r = False
            Else
                AdditionServiceView.SetColumnError(AddPerformerColumn, String.Empty)
            End If

            If AdditionServiceView.GetRowCellValue(row, AddPrice) Is DBNull.Value Then
                AdditionServiceView.SetColumnError(AddPrice, Res.ErrorZeroCostService)
                r = False
                'ElseIf CDbl(AdditionServiceView.GetRowCellValue(row, AddPrice)) <= 0 Then
                '    AdditionServiceView.SetColumnError(AddPrice, Res.ErrorZeroCostService)
                '    r = False
            Else
                AdditionServiceView.SetColumnError(AddPrice, String.Empty)
            End If



            Return r
        End Function


        Private Function ValidateService(ByVal row As Integer) As Boolean
            Dim bs As BillService = ServiceView.GetRow(row)
            If bs Is Nothing Then Return True

            Dim r As Boolean = True

            ServiceView.SelectRow(row)

            'If (ServiceView.GetRowCellValue(row, CostColumn) <= 0) And bs.Selected Then
            'ServiceView.SetColumnError(CostColumn, Res.ErrorZeroCostService)
            'r = False
            'Else
            '    ServiceView.SetColumnError(CostColumn, String.Empty)
            'End If
            ServiceView.SetColumnError(CostColumn, String.Empty)

            Return r
        End Function



        Private Function ValidateServices() As Boolean
            Dim res As Boolean = True
            For i As Integer = 0 To AdditionServiceView.RowCount - 1
                If Not ValidateAdditionalService(i) Then
                    res = False
                    Exit For
                End If
            Next

            For i As Integer = 0 To ServiceView.RowCount - 1
                If Not ValidateService(i) Then
                    res = False
                    Exit For
                End If
            Next

            Return res
        End Function


        Public Overrides Function DataValidate() As Boolean
            If Not MyBase.DataValidate Then Return False

            PaymentView.CloseEditor()
            AdditionServiceView.CloseEditor()

            Dim res As Boolean = True
            If Not ValidateClient() Then
                Tabs.SelectedIndex = 0
                res = False
            End If

            If Not ValidateAmount() Then
                res = False
            End If

            If Not ValidatePaid() Then
                res = False
            End If

            If Not ValidatePayments() Then
                res = False
                Tabs.SelectedIndex = 2
            End If

            If Not ValidateServices() Then
                res = False
                Tabs.SelectedIndex = 0
            End If

            Return res
        End Function


        Private Sub ServiceView_InvalidRowException(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.InvalidRowExceptionEventArgs) Handles ServiceView.InvalidRowException
            e.ExceptionMode = DevExpress.XtraEditors.Controls.ExceptionMode.NoAction
        End Sub

#End Region

#Region " Additional Services "
        Private Sub AsServiceRI_QueryDisplayText(ByVal sender As System.Object, ByVal e As DevExpress.XtraEditors.Controls.QueryDisplayTextEventArgs) Handles AddServiceRI.QueryDisplayText
            If e.EditValue Is Nothing Then Return
            If e.EditValue Is DBNull.Value Then Return

            e.DisplayText = AppDataLayer.Services.FindByServiceID(e.EditValue).Label
        End Sub

        Private Sub AsServiceRI_QueryResultValue(ByVal sender As System.Object, ByVal e As DevExpress.XtraEditors.Controls.QueryResultValueEventArgs) Handles AddServiceRI.QueryResultValue
            Dim r As Integer = AsServiceView.FocusedRowHandle
            If IsInvalidRowHandle(r) Then
                e.Value = DBNull.Value
            Else
                Dim s As DataSetData.Service = AsServiceView.GetDataRow(r)
                If Not s Is Nothing Then
                    e.Value = s.ServiceID()
                Else
                    e.Value = DBNull.Value
                End If
            End If
        End Sub

        Private Sub AsServiceView_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles AsServiceView.MouseDown
            If (e.Button = MouseButtons.Left) And (e.Clicks > 1) Then
                Dim ed As DevExpress.XtraEditors.PopupContainerEdit = AsServicePopupControl.OwnerEdit
                If Not ed Is Nothing Then
                    ed.ClosePopup()
                End If
            End If
        End Sub

        Private Sub AsPerformerRI_QueryDisplayText(ByVal sender As System.Object, ByVal e As DevExpress.XtraEditors.Controls.QueryDisplayTextEventArgs) Handles AddPerformerRI.QueryDisplayText
            If e.EditValue Is Nothing Then Return
            If e.EditValue Is DBNull.Value Then Return

            e.DisplayText = AppDataLayer.Employees.FindByEmployeeID(e.EditValue).FullName
        End Sub

        Private Sub AsPerformerRI_QueryResultValue(ByVal sender As System.Object, ByVal e As DevExpress.XtraEditors.Controls.QueryResultValueEventArgs) Handles AddPerformerRI.QueryResultValue
            Dim r As Integer = AsEmployeeView.FocusedRowHandle
            If IsInvalidRowHandle(r) Then
                e.Value = DBNull.Value
            Else
                Dim em As DataSetData.Employee = AsEmployeeView.GetDataRow(r)
                If em Is Nothing Then
                    e.Value = DBNull.Value
                Else
                    e.Value = em.EmployeeID
                End If
            End If
        End Sub

        Private Sub AsEmployeeView_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles AsEmployeeView.MouseDown
            If (e.Button = MouseButtons.Left) And (e.Clicks > 1) Then
                Dim ed As DevExpress.XtraEditors.PopupContainerEdit = AsEmployeePopupControl.OwnerEdit
                If Not ed Is Nothing Then
                    ed.ClosePopup()
                End If
            End If
        End Sub

        Private Sub AdditionServiceView_InitNewRow(ByVal sender As Object, ByVal e As DevExpress.Data.InitNewRowEventArgs) Handles AdditionServiceView.InitNewRow
            Dim app As DataSetAppointments.Appointment = AdditionServiceView.GetDataRow(e.RowHandle)
            If Not Security.CurrentUser.Sys Then
                app.PerformerID = Security.CurrentUser.EmployeeID
            End If
            UpdateEmployee()
        End Sub


        Private Sub AdditionServiceView_CellValueChanged(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs) Handles AdditionServiceView.CellValueChanged
            If (e.Column Is AddServiceColumn) Or (e.Column Is AddPerformerColumn) Then
                Dim app As DataSetAppointments.Appointment = AdditionServiceView.GetDataRow(e.RowHandle)
                If (app.PerformerID <> 0) And (app.ServiceID <> 0) Then

                    Dim ml As Integer = AppDataLayer.Employees.FindByEmployeeID(app.PerformerID).MasterLevelID
                    For Each sp As DataSetData.ServiceParam In AppDataLayer.Services.FindByServiceID(app.ServiceID).GetServiceParams()
                        If sp.MasterLevelID = ml Then
                            app.ServiceCost = Math.Round(sp.Price, 2)
                            Exit For
                        End If
                    Next
                End If
            End If
            If e.Column Is AddPrice Then
                Dim val As Decimal
                val = Math.Round(CDec(e.Value), 2)
                If val <> e.Value Then
                    AdditionServiceView.SetRowCellValue(e.RowHandle, AddPrice, val)
                End If
            End If
            UpdateCost()
            UpdateEmployee()
        End Sub


        Private Sub AdditionServiceView_InvalidRowException(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.InvalidRowExceptionEventArgs) Handles AdditionServiceView.InvalidRowException
            e.ExceptionMode = DevExpress.XtraEditors.Controls.ExceptionMode.NoAction
        End Sub


#End Region

#Region " Products "
        Private Sub SelectedProductView_CellValueChanged(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs) Handles SelectedProductView.CellValueChanged
            If e.Column Is SCostColunm Then
                Dim val As Decimal
                val = Math.Round(CDec(e.Value), 2)
                If val <> e.Value Then
                    SelectedProductView.SetRowCellValue(e.RowHandle, SCostColunm, val)
                End If
            End If
            UpdateCost()
        End Sub

#End Region

    End Class


#Region " BillService class "
    Friend Class BillService
        Private mApp As DataSetAppointments.Appointment
        Private mService As DataSetData.Service
        Private mSelected As Boolean = False
        Private mCost As Double

        Private ReadOnly Property Service() As DataSetData.Service
            Get
                If mService Is Nothing Then mService = AppDataLayer.Services.FindByServiceID(mApp.ServiceID)
                Return mService
            End Get
        End Property


        Public Sub New(ByVal app As DataSetAppointments.Appointment)
            mApp = app
            mApp.ServiceCost = Math.Round(AppointmentHelper.ExpectedServiceCost(app), 2)
            mCost = mApp.ServiceCost
            mService = Nothing
        End Sub

        Public ReadOnly Property Appointment() As DataSetAppointments.Appointment
            Get
                Return mApp
            End Get
        End Property


        Public ReadOnly Property ServiceName() As String
            Get
                Return Service.Label
            End Get
        End Property

        Public ReadOnly Property ServiceType() As String
            Get
                Return Service.Type
            End Get
        End Property

        Public Property ServiceCost() As Double
            Get
                Return mCost
            End Get
            Set(ByVal Value As Double)
                mCost = Value
            End Set
        End Property

        Public Property Selected() As Boolean
            Get
                Return mSelected
            End Get
            Set(ByVal Value As Boolean)
                mSelected = Value
            End Set
        End Property

        Public Sub UpdateCost()
            mApp.ServiceCost = mCost
        End Sub

    End Class
#End Region

End Namespace